package lapsnake.model.misc;

import lapsnake.model.*;
import lapsnake.model.data.*;
import lapsnake.model.expr.LapName;
import lapsnake.py.ast.ASTHelperFactory; import java.beans.PropertyVetoException;

import org.python.antlr.ast.*;
import org.python.antlr.runtime.Token;

/**Wrapper class with helper functions for keyword nodes*/
public class LapKeyword extends LapNode {
	SingleChild<LapName> key = new SingleChild<>(this, LapName.class);
	SingleChild<LapExpression> value = new SingleChild<>(this, LapExpression.class);
	
	public LapKeyword(PyAST pyAST, ChildField<? super LapKeyword> parent, keyword node) throws PropertyVetoException 
	{
		super(pyAST, parent, node);
		//Hax.
		Token token = node.getToken();
		ASTHelperFactory.makeHelper(pyAST, key, new Name(token, node.getInternalArg(), expr_contextType.UNDEFINED));
		ASTHelperFactory.makeHelper(pyAST, value, node.getInternalValue());
		buildTextNodes(node);
	}
}
